package com.qubuyer.business.mine.adapter

import android.content.Intent
import com.qubuyer.R
import com.qubuyer.business.mine.activity.RebateOrderDetailActivity
import com.qubuyer.databinding.ItemRebateOrderListBinding
import com.qubuyer.repository.entitys.RebateOrderEntity
import com.qubyer.widget.adapter.BindingRvAdapter

/**
 * @author Susong
 * @date 创建时间2019/4/3
 * @description 折让订单adapter
 */
class RebateOrderAdapter(private val mType: Int) :
    BindingRvAdapter<RebateOrderEntity, ItemRebateOrderListBinding>() {

    override val itemLayout: Int
        get() = R.layout.item_rebate_order_list

    override fun onBind(data: RebateOrderEntity, dataBinding: ItemRebateOrderListBinding) {
        dataBinding.host = this
        dataBinding.data = data
    }

    fun onItemClick(data: RebateOrderEntity) {
        if (mType == 2) {
            mContext?.startActivity(
                Intent(
                    mContext,
                    RebateOrderDetailActivity::class.java
                ).putExtra("id", data.rec_id)
            )
        }
    }
}